﻿
using Fibot.Module.WangDianTong.Qimen.QimenCloud;
using Fibot.Module.WangDianTong.Qimen.QimenCloud.Request;
using Fibot.Module.WangDianTong.Qimen.QimenCloud.Response;

namespace Fibot.Module.WangDianTong.Qimen
{
    public class WdtQimenManager
    {
        public WdtQimenOptions options;

        public WdtQimenManager() 
        {
        
        }

        public WdtQimenManager(WdtQimenOptions options)
        {
            this.options = options;
        }



        public string queryStockoutOrderTradeService(DateTime startTime, DateTime endTime, int pageNo, int pageSize, int status)
        {

            string serverUrl = "https://hu3cgwt0tc.api.taobao.com/router/qm";
            string appKey = "34607213";//自己申请的奇门appkey
            string appSecret = "0ca1849508404c09e290d0caace446af";//自己申请的奇门appkey对应的secret
            string format = "json";

            DefaultQimenCloudClient client = new DefaultQimenCloudClient(serverUrl, appKey, appSecret, format);
            WdtStockoutOrderQueryTradeRequest req = new WdtStockoutOrderQueryTradeRequest();
            req.SetTargetAppKey("21363512");//旺店通的奇门appkey
            req.Sid = "hyyy02";//旺店通erp的卖家账号
            req.StartTime = "2023-11-25 13:35:32";
            req.EndTime = "2023-11-25 23:35:32";
            req.PageSize = 100L;
            req.PageNo = 0L;

            try
            {
                WdtStockoutOrderQueryTradeResponse res = client.Execute(req);
                Console.Write("code:" + res.Errorcode);
                Console.Write("message:" + res.Message);
                Console.Write("body:" + res.Body);
            }
            catch (TopException e)
            {
                // TODO Auto-generated catch block
            }

            return "";
        }
    }
}
